<?php

namespace app\admin\model;

use think\Db;
use think\Model;

class AuthgroupaccessModel extends Model
{

    // 设置数据表（不含前缀）
    protected $name = 'auth_group_access';

    public function __construct($data = [])
    {
        parent::__construct($data);
        $this->_collection = Db::name($this->name);
    }


    /**
     * @param $useradd
     * @param 添加用户
     */
    public function useradd($guopr){
        // 启动事务
        Db::startTrans();
        try{
            $query = Db::name($this->name)->insert($guopr);
            // 提交事务
            Db::commit();
            return $query;
        } catch (\Exception $e) {
            // 回滚事务
            Db::rollback();
            return false;
        }
    }

}